package cn.edu.xjtu.nbrash.xbarsuite.terry;

//import com.google.zxing.integration.android.IntentIntegrator;


import com.google.zxing.client.android.Contents;
import com.google.zxing.client.android.Intents;

import cn.edu.xjtu.nbrash.xbarsuite.R;
import cn.edu.xjtu.nbrash.xbarsuite.R.layout;
import cn.edu.xjtu.nbrash.xbarsuite.R.menu;
import cn.edu.xjtu.nbrash.xbarsuite.zxingdemo.RashDisplayActivity;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.app.Activity;
import android.content.Intent;
import android.text.InputType;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;

public class EncodeEmail extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_encode_email);
		
		final EditText emailEdit = (EditText) findViewById(R.id.email_text);
		emailEdit.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
		


		
	}
	public void showQR(View v) {
		String mailTo = ((TextView) findViewById(R.id.email_text)).getText().toString();
		String theme = ((TextView) findViewById(R.id.theme_text)).getText().toString();
		String content = ((TextView) findViewById(R.id.content_Text)).getText().toString();
		
		String data = mailTo+"?"+"subject="+theme+"&body="+content;

		if(mailTo != null && !mailTo.equals("")){
			Intent intent = new Intent(this, RashDisplayActivity.class);
			// ACTION 是 ENCODE
			intent.setAction(Intents.Encode.ACTION);
			// 类型是TEXT，这里可以有很多中类型，具体参见QRCodeEncoder源码
			intent.putExtra(Intents.Encode.TYPE, Contents.Type.EMAIL);
			// 数据，这里是字符串
			intent.putExtra(Intents.Encode.DATA, data);
			startActivity(intent);
		}
	}
//	public void showQR(View v) {
//		String mailTo = ((TextView) findViewById(R.id.email_text)).getText().toString();
//		String theme = ((TextView) findViewById(R.id.theme_text)).getText().toString();
//		String content = ((TextView) findViewById(R.id.content_Text)).getText().toString();
//		
//		if(mailTo != null && !mailTo.equals("")){
//			Intent intent = new Intent(this, RashDisplayActivity.class);
//			Bundle bundle = new Bundle();
//			
//			// ACTION 是 ENCODE
//			intent.setAction(Intents.Encode.ACTION);
//			// 类型是TEXT，这里可以有很多中类型，具体参见QRCodeEncoder源码
//			intent.putExtra(Intents.Encode.TYPE, Contents.Type.EMAIL_ALL);
//			// 数据，这里是字符串
//			bundle.putString(SomeNewConstant.MAILTO, mailTo);
//			bundle.putString(SomeNewConstant.TITLE, theme);
//			bundle.putString(SomeNewConstant.CONTENT, content);
//			
//			intent.putExtra(Intents.Encode.DATA,bundle);
//			startActivity(intent);
//		}
//	}
	
}
